.class public Lcom/estrongs/chromecast/ChromeCastDialog;
.super Lcom/estrongs/android/ui/dialog/q;
.source "ChromeCastDialog.java"

# interfaces
.implements Lcom/estrongs/chromecast/CastDeviceListener;
.implements Lcom/estrongs/chromecast/ChromeCastConnectionListener;


# static fields
.field private static final MESSAGE_SEARCH_FAILED:I = 0x0

.field private static final MODE_CONNECTED:I = 0x4

.field private static final MODE_CONNECTING:I = 0x5

.field private static final MODE_INIT:I = 0x0

.field private static final MODE_LIST:I = 0x3

.field private static final MODE_SEARCHING:I = 0x1

.field private static final MODE_SEARCHING_FAILED:I = 0x2

.field private static final SEARCHING_TIMEOUT:I = 0x2710

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private connectSucceed:Z

.field private isInitProcessing:Z

.field private mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

.field private mChromeCastModeListener:Lcom/estrongs/android/pop/app/a0;

.field private mContext:Landroid/app/Activity;

.field private mCurrentMode:I

.field private mHandler:Landroid/os/Handler;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .line 1
    const-class v0, Lcom/estrongs/chromecast/ChromeCastDialog;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/estrongs/chromecast/ChromeCastDialog;->TAG:Ljava/lang/String;

    return-void
.end method

.method public constructor <init>(Landroid/app/Activity;)V
    .locals 2

    .line 1
    invoke-direct {p0, p1}, Lcom/estrongs/android/ui/dialog/q;-><init>(Landroid/content/Context;)V

    .line 2
    invoke-static {}, Lcom/estrongs/chromecast/ChromeCastManager;->getInstance()Lcom/estrongs/chromecast/ChromeCastManager;

    move-result-object v0

    iput-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    const/4 v0, 0x0

    .line 3
    iput-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mHandler:Landroid/os/Handler;

    const/4 v1, -0x1

    .line 4
    iput v1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mCurrentMode:I

    const/4 v1, 0x0

    .line 5
    iput-boolean v1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->connectSucceed:Z

    .line 6
    iput-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    .line 7
    iput-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastModeListener:Lcom/estrongs/android/pop/app/a0;

    .line 8
    iput-boolean v1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->isInitProcessing:Z

    .line 9
    iput-object p1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    .line 10
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->initHandler()V

    .line 11
    iget-object p1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {p1}, Lcom/estrongs/chromecast/ChromeCastManager;->isLoaded()Z

    move-result p1

    if-eqz p1, :cond_0

    .line 12
    iget-object p1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {p1}, Lcom/estrongs/chromecast/ChromeCastManager;->init()Z

    .line 13
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->initListeners()V

    :cond_0
    return-void
.end method

.method static synthetic access$000(Lcom/estrongs/chromecast/ChromeCastDialog;)Lcom/estrongs/chromecast/ChromeCastManager;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    return-object p0
.end method

.method static synthetic access$100(Lcom/estrongs/chromecast/ChromeCastDialog;)V
    .locals 0

    .line 1
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->changeToSearchFailMode()V

    return-void
.end method

.method static synthetic access$200(Lcom/estrongs/chromecast/ChromeCastDialog;)V
    .locals 0

    .line 1
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->changeToListMode()V

    return-void
.end method

.method static synthetic access$302(Lcom/estrongs/chromecast/ChromeCastDialog;Z)Z
    .locals 0

    .line 1
    iput-boolean p1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->isInitProcessing:Z

    return p1
.end method

.method static synthetic access$400(Lcom/estrongs/chromecast/ChromeCastDialog;)V
    .locals 0

    .line 1
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->initListeners()V

    return-void
.end method

.method static synthetic access$500(Lcom/estrongs/chromecast/ChromeCastDialog;)V
    .locals 0

    .line 1
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->changeToSearchingMode()V

    return-void
.end method

.method static synthetic access$600(Lcom/estrongs/chromecast/ChromeCastDialog;)Landroid/os/Handler;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mHandler:Landroid/os/Handler;

    return-object p0
.end method

.method static synthetic access$700(Lcom/estrongs/chromecast/ChromeCastDialog;)V
    .locals 0

    .line 1
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->changeToConnectingMode()V

    return-void
.end method

.method static synthetic access$800(Lcom/estrongs/chromecast/ChromeCastDialog;)Lcom/estrongs/android/pop/app/a0;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastModeListener:Lcom/estrongs/android/pop/app/a0;

    return-object p0
.end method

.method private changeToConnectedMode()V
    .locals 2

    const/4 v0, 0x4

    .line 1
    iput v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mCurrentMode:I

    .line 2
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v1, 0x7f110235

    invoke-virtual {v0, v1}, Landroid/app/Activity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setTitle(Ljava/lang/CharSequence;)V

    .line 3
    invoke-virtual {p0}, Lcom/estrongs/android/ui/dialog/q;->hideProgressBar()V

    .line 4
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0}, Lcom/estrongs/chromecast/ChromeCastManager;->getConnectedDevice()Lcom/estrongs/chromecast/CastDeviceInfo;

    move-result-object v0

    if-eqz v0, :cond_0

    .line 5
    invoke-virtual {v0}, Lcom/estrongs/chromecast/CastDeviceInfo;->getFriendlyName()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setMessage(Ljava/lang/CharSequence;)V

    .line 6
    :cond_0
    invoke-virtual {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->removeListView()V

    .line 7
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v1, 0x7f11022c

    invoke-virtual {v0, v1}, Landroid/app/Activity;->getText(I)Ljava/lang/CharSequence;

    move-result-object v0

    new-instance v1, Lcom/estrongs/chromecast/ChromeCastDialog$6;

    invoke-direct {v1, p0}, Lcom/estrongs/chromecast/ChromeCastDialog$6;-><init>(Lcom/estrongs/chromecast/ChromeCastDialog;)V

    invoke-virtual {p0, v0, v1}, Lcom/estrongs/android/ui/dialog/q;->setConfirmButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/widget/Button;

    .line 8
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v1, 0x7f110045

    invoke-virtual {v0, v1}, Landroid/app/Activity;->getText(I)Ljava/lang/CharSequence;

    move-result-object v0

    new-instance v1, Lcom/estrongs/chromecast/ChromeCastDialog$7;

    invoke-direct {v1, p0}, Lcom/estrongs/chromecast/ChromeCastDialog$7;-><init>(Lcom/estrongs/chromecast/ChromeCastDialog;)V

    invoke-virtual {p0, v0, v1}, Lcom/estrongs/android/ui/dialog/q;->setCancelButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/widget/Button;

    return-void
.end method

.method private changeToConnectingMode()V
    .locals 2

    const/4 v0, 0x5

    .line 1
    iput v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mCurrentMode:I

    .line 2
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v1, 0x7f110235

    invoke-virtual {v0, v1}, Landroid/app/Activity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setTitle(Ljava/lang/CharSequence;)V

    const/4 v0, 0x0

    .line 3
    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setMessage(Ljava/lang/CharSequence;)V

    .line 4
    invoke-virtual {p0}, Lcom/estrongs/android/ui/dialog/q;->showProgressBar()V

    const/4 v0, 0x1

    .line 5
    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setAllButtonsEnabled(Z)V

    .line 6
    invoke-virtual {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->removeListView()V

    .line 7
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v1, 0x7f110299

    invoke-virtual {v0, v1}, Landroid/app/Activity;->getText(I)Ljava/lang/CharSequence;

    move-result-object v0

    new-instance v1, Lcom/estrongs/chromecast/ChromeCastDialog$5;

    invoke-direct {v1, p0}, Lcom/estrongs/chromecast/ChromeCastDialog$5;-><init>(Lcom/estrongs/chromecast/ChromeCastDialog;)V

    invoke-virtual {p0, v0, v1}, Lcom/estrongs/android/ui/dialog/q;->setSingleButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V

    return-void
.end method

.method private changeToInitMode()V
    .locals 3

    const/4 v0, 0x0

    .line 1
    iput v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mCurrentMode:I

    .line 2
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v1, 0x7f110235

    invoke-virtual {v0, v1}, Landroid/app/Activity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setTitle(Ljava/lang/CharSequence;)V

    .line 3
    invoke-virtual {p0}, Lcom/estrongs/android/ui/dialog/q;->showProgressBar()V

    const/4 v0, 0x1

    .line 4
    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setAllButtonsEnabled(Z)V

    const/4 v0, 0x0

    .line 5
    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setMessage(Ljava/lang/CharSequence;)V

    .line 6
    invoke-virtual {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->removeListView()V

    .line 7
    iget-object v1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v2, 0x7f110299

    invoke-virtual {v1, v2}, Landroid/app/Activity;->getText(I)Ljava/lang/CharSequence;

    move-result-object v1

    invoke-virtual {p0, v1, v0}, Lcom/estrongs/android/ui/dialog/q;->setSingleButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V

    .line 8
    iget-boolean v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->isInitProcessing:Z

    if-nez v0, :cond_0

    .line 9
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->initChromeCast()V

    :cond_0
    return-void
.end method

.method private changeToListMode()V
    .locals 5

    const/4 v0, 0x3

    .line 1
    iput v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mCurrentMode:I

    .line 2
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v1, 0x7f110235

    invoke-virtual {v0, v1}, Landroid/app/Activity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setTitle(Ljava/lang/CharSequence;)V

    .line 3
    invoke-virtual {p0}, Lcom/estrongs/android/ui/dialog/q;->hideAllButtons()V

    const/4 v0, 0x0

    .line 4
    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setMessage(Ljava/lang/CharSequence;)V

    const/4 v0, 0x0

    .line 5
    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setSelectable(Z)V

    .line 6
    invoke-virtual {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->removeListView()V

    .line 7
    iget-object v1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v1}, Lcom/estrongs/chromecast/ChromeCastManager;->getDevices()Ljava/util/List;

    move-result-object v1

    if-eqz v1, :cond_1

    .line 8
    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v2

    if-eqz v2, :cond_1

    .line 9
    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v2

    new-array v2, v2, [Ljava/lang/String;

    const/4 v3, 0x0

    .line 10
    :goto_0
    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v4

    if-ge v3, v4, :cond_0

    .line 11
    invoke-interface {v1, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Lcom/estrongs/chromecast/CastDeviceInfo;

    invoke-virtual {v4}, Lcom/estrongs/chromecast/CastDeviceInfo;->getFriendlyName()Ljava/lang/String;

    move-result-object v4

    aput-object v4, v2, v3

    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    .line 12
    :cond_0
    new-instance v3, Lcom/estrongs/chromecast/ChromeCastDialog$4;

    invoke-direct {v3, p0, v1}, Lcom/estrongs/chromecast/ChromeCastDialog$4;-><init>(Lcom/estrongs/chromecast/ChromeCastDialog;Ljava/util/List;)V

    invoke-virtual {p0, v2, v0, v3}, Lcom/estrongs/android/ui/dialog/q;->setItems([Ljava/lang/CharSequence;ILandroid/content/DialogInterface$OnClickListener;)V

    goto :goto_1

    .line 13
    :cond_1
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->changeToSearchFailMode()V

    .line 14
    :goto_1
    invoke-virtual {p0}, Lcom/estrongs/android/ui/dialog/q;->hideProgressBar()V

    return-void
.end method

.method private changeToSearchFailMode()V
    .locals 3

    const/4 v0, 0x2

    .line 1
    iput v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mCurrentMode:I

    .line 2
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v1, 0x7f110235

    invoke-virtual {v0, v1}, Landroid/app/Activity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setTitle(Ljava/lang/CharSequence;)V

    .line 3
    invoke-virtual {p0}, Lcom/estrongs/android/ui/dialog/q;->hideProgressBar()V

    .line 4
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    iget-object v1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v2, 0x7f110230

    invoke-virtual {v1, v2}, Landroid/app/Activity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v1, "<font size=\'8px\' color=\'grey\'><br />"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v2, 0x7f110231

    invoke-virtual {v1, v2}, Landroid/app/Activity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v1, "</font>"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    .line 5
    invoke-static {v0}, Landroid/text/Html;->fromHtml(Ljava/lang/String;)Landroid/text/Spanned;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setMessage(Ljava/lang/CharSequence;)V

    .line 6
    invoke-virtual {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->removeListView()V

    .line 7
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v1, 0x7f110664

    invoke-virtual {v0, v1}, Landroid/app/Activity;->getText(I)Ljava/lang/CharSequence;

    move-result-object v0

    new-instance v1, Lcom/estrongs/chromecast/ChromeCastDialog$3;

    invoke-direct {v1, p0}, Lcom/estrongs/chromecast/ChromeCastDialog$3;-><init>(Lcom/estrongs/chromecast/ChromeCastDialog;)V

    invoke-virtual {p0, v0, v1}, Lcom/estrongs/android/ui/dialog/q;->setConfirmButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/widget/Button;

    .line 8
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v1, 0x7f110299

    invoke-virtual {v0, v1}, Landroid/app/Activity;->getText(I)Ljava/lang/CharSequence;

    move-result-object v0

    const/4 v1, 0x0

    invoke-virtual {p0, v0, v1}, Lcom/estrongs/android/ui/dialog/q;->setCancelButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/widget/Button;

    return-void
.end method

.method private changeToSearchingMode()V
    .locals 4

    const/4 v0, 0x1

    .line 1
    iput v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mCurrentMode:I

    .line 2
    iget-object v1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v2, 0x7f110235

    invoke-virtual {v1, v2}, Landroid/app/Activity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Lcom/estrongs/android/ui/dialog/q;->setTitle(Ljava/lang/CharSequence;)V

    .line 3
    invoke-virtual {p0}, Lcom/estrongs/android/ui/dialog/q;->showProgressBar()V

    .line 4
    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setAllButtonsEnabled(Z)V

    const/4 v0, 0x0

    .line 5
    invoke-virtual {p0, v0}, Lcom/estrongs/android/ui/dialog/q;->setMessage(Ljava/lang/CharSequence;)V

    .line 6
    invoke-virtual {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->removeListView()V

    .line 7
    iget-object v1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v2, 0x7f110299

    invoke-virtual {v1, v2}, Landroid/app/Activity;->getText(I)Ljava/lang/CharSequence;

    move-result-object v1

    invoke-virtual {p0, v1, v0}, Lcom/estrongs/android/ui/dialog/q;->setSingleButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V

    .line 8
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mHandler:Landroid/os/Handler;

    const/4 v1, 0x0

    const-wide/16 v2, 0x2710

    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->sendEmptyMessageDelayed(IJ)Z

    .line 9
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0}, Lcom/estrongs/chromecast/ChromeCastManager;->startScan()V

    return-void
.end method

.method private initChromeCast()V
    .locals 2

    .line 1
    new-instance v0, Ljava/lang/Thread;

    new-instance v1, Lcom/estrongs/chromecast/ChromeCastDialog$2;

    invoke-direct {v1, p0}, Lcom/estrongs/chromecast/ChromeCastDialog$2;-><init>(Lcom/estrongs/chromecast/ChromeCastDialog;)V

    invoke-direct {v0, v1}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V

    .line 2
    invoke-virtual {v0}, Ljava/lang/Thread;->start()V

    return-void
.end method

.method private initHandler()V
    .locals 1

    .line 1
    new-instance v0, Lcom/estrongs/chromecast/ChromeCastDialog$1;

    invoke-direct {v0, p0}, Lcom/estrongs/chromecast/ChromeCastDialog$1;-><init>(Lcom/estrongs/chromecast/ChromeCastDialog;)V

    iput-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mHandler:Landroid/os/Handler;

    return-void
.end method

.method private initListeners()V
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0, p0}, Lcom/estrongs/chromecast/ChromeCastManager;->addConnectionListener(Lcom/estrongs/chromecast/ChromeCastConnectionListener;)V

    .line 2
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0, p0}, Lcom/estrongs/chromecast/ChromeCastManager;->addDeviceListener(Lcom/estrongs/chromecast/CastDeviceListener;)V

    return-void
.end method


# virtual methods
.method public destory()V
    .locals 1

    .line 1
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0, p0}, Lcom/estrongs/chromecast/ChromeCastManager;->removeConnectionListener(Lcom/estrongs/chromecast/ChromeCastConnectionListener;)V

    .line 2
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0, p0}, Lcom/estrongs/chromecast/ChromeCastManager;->removeDeviceListener(Lcom/estrongs/chromecast/CastDeviceListener;)V

    return-void
.end method

.method public dismiss()V
    .locals 0

    .line 1
    invoke-super {p0}, Lcom/estrongs/android/ui/dialog/q;->dismiss()V

    return-void
.end method

.method public isConnnectSucceed()Z
    .locals 1

    .line 1
    iget-boolean v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->connectSucceed:Z

    return v0
.end method

.method public onConnected()V
    .locals 1

    const/4 v0, 0x1

    .line 1
    iput-boolean v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->connectSucceed:Z

    .line 2
    invoke-virtual {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->dismiss()V

    .line 3
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastModeListener:Lcom/estrongs/android/pop/app/a0;

    if-eqz v0, :cond_0

    .line 4
    invoke-interface {v0}, Lcom/estrongs/android/pop/app/a0;->b()V

    :cond_0
    return-void
.end method

.method public onConnectionFailed()V
    .locals 3

    .line 1
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->changeToListMode()V

    const/4 v0, 0x0

    .line 2
    iput-boolean v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->connectSucceed:Z

    .line 3
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v1, 0x7f110770

    const/4 v2, 0x1

    invoke-static {v0, v1, v2}, Lcom/estrongs/android/ui/view/d;->a(Landroid/content/Context;II)V

    .line 4
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastModeListener:Lcom/estrongs/android/pop/app/a0;

    if-eqz v0, :cond_0

    .line 5
    invoke-interface {v0}, Lcom/estrongs/android/pop/app/a0;->a()V

    :cond_0
    return-void
.end method

.method public onConnectionSuspended()V
    .locals 0

    return-void
.end method

.method public onDeviceAdded(Lcom/estrongs/chromecast/CastDeviceInfo;)V
    .locals 1

    .line 1
    :try_start_0
    invoke-virtual {p0}, Lcom/estrongs/android/ui/dialog/q;->isDismissed()Z

    move-result p1

    if-nez p1, :cond_0

    .line 2
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->changeToListMode()V

    .line 3
    :cond_0
    iget-object p1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mHandler:Landroid/os/Handler;

    const/4 v0, 0x0

    invoke-virtual {p1, v0}, Landroid/os/Handler;->removeMessages(I)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception p1

    .line 4
    invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V

    :goto_0
    return-void
.end method

.method public onDeviceRemoved(Lcom/estrongs/chromecast/CastDeviceInfo;)V
    .locals 1

    .line 1
    iget p1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mCurrentMode:I

    const/4 v0, 0x3

    if-ne p1, v0, :cond_0

    .line 2
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->changeToListMode()V

    :cond_0
    return-void
.end method

.method public onDeviceSelected(Lcom/estrongs/chromecast/CastDeviceInfo;)V
    .locals 0

    return-void
.end method

.method public onDeviceUnSelected(Lcom/estrongs/chromecast/CastDeviceInfo;)V
    .locals 0

    const/4 p1, 0x0

    .line 1
    iput-boolean p1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->connectSucceed:Z

    .line 2
    iget-object p1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastModeListener:Lcom/estrongs/android/pop/app/a0;

    if-eqz p1, :cond_0

    .line 3
    invoke-interface {p1}, Lcom/estrongs/android/pop/app/a0;->a()V

    :cond_0
    return-void
.end method

.method public onDeviceVolumeChanged(Lcom/estrongs/chromecast/CastDeviceInfo;)V
    .locals 0

    return-void
.end method

.method public onDisconnected()V
    .locals 0

    return-void
.end method

.method public removeListView()V
    .locals 2

    .line 1
    iget-object v0, p0, Lcom/estrongs/android/ui/dialog/q;->mContentContainer:Landroid/widget/FrameLayout;

    if-eqz v0, :cond_0

    iget-object v1, p0, Lcom/estrongs/android/ui/dialog/q;->listView:Landroid/widget/ListView;

    if-eqz v1, :cond_0

    .line 2
    invoke-virtual {v0, v1}, Landroid/widget/FrameLayout;->removeView(Landroid/view/View;)V

    const/4 v0, 0x0

    .line 3
    iput-object v0, p0, Lcom/estrongs/android/ui/dialog/q;->listView:Landroid/widget/ListView;

    :cond_0
    return-void
.end method

.method public setChromeCastModeListener(Lcom/estrongs/android/pop/app/a0;)V
    .locals 0

    .line 1
    iput-object p1, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastModeListener:Lcom/estrongs/android/pop/app/a0;

    return-void
.end method

.method public show()V
    .locals 3

    .line 1
    invoke-static {}, Lcom/estrongs/android/util/f0;->d()Z

    move-result v0

    const/4 v1, 0x1

    if-nez v0, :cond_0

    .line 2
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v2, 0x7f110b78

    invoke-static {v0, v2, v1}, Lcom/estrongs/android/ui/view/d;->a(Landroid/content/Context;II)V

    return-void

    :cond_0
    const-string v0, "com.android.vending"

    .line 3
    invoke-static {v0}, Lcom/estrongs/android/pop/utils/k;->b(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_1

    .line 4
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mContext:Landroid/app/Activity;

    const v2, 0x7f11022e

    invoke-static {v0, v2, v1}, Lcom/estrongs/android/ui/view/d;->a(Landroid/content/Context;II)V

    return-void

    .line 5
    :cond_1
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0}, Lcom/estrongs/chromecast/ChromeCastManager;->isInited()Z

    move-result v0

    if-nez v0, :cond_2

    .line 6
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->changeToInitMode()V

    goto :goto_2

    .line 7
    :cond_2
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0}, Lcom/estrongs/chromecast/ChromeCastManager;->isConnected()Z

    move-result v0

    if-eqz v0, :cond_3

    .line 8
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->changeToConnectedMode()V

    goto :goto_1

    .line 9
    :cond_3
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0}, Lcom/estrongs/chromecast/ChromeCastManager;->getDevices()Ljava/util/List;

    move-result-object v0

    if-eqz v0, :cond_5

    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0}, Lcom/estrongs/chromecast/ChromeCastManager;->getDevices()Ljava/util/List;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-nez v0, :cond_4

    goto :goto_0

    .line 10
    :cond_4
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0}, Lcom/estrongs/chromecast/ChromeCastManager;->getDevices()Ljava/util/List;

    move-result-object v0

    if-eqz v0, :cond_6

    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0}, Lcom/estrongs/chromecast/ChromeCastManager;->getDevices()Ljava/util/List;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-lez v0, :cond_6

    .line 11
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->changeToListMode()V

    goto :goto_1

    .line 12
    :cond_5
    :goto_0
    invoke-direct {p0}, Lcom/estrongs/chromecast/ChromeCastDialog;->changeToSearchingMode()V

    .line 13
    :cond_6
    :goto_1
    iget-object v0, p0, Lcom/estrongs/chromecast/ChromeCastDialog;->mChromeCastManager:Lcom/estrongs/chromecast/ChromeCastManager;

    invoke-virtual {v0}, Lcom/estrongs/chromecast/ChromeCastManager;->startScan()V

    .line 14
    :goto_2
    invoke-super {p0}, Lcom/estrongs/android/ui/dialog/q;->show()V

    return-void
.end method
